package com.hnx.admin.system.controller;

import com.hnx.admin.annonation.LoginLog;
import com.hnx.admin.system.domain.param.user.query.LoginBody;
import com.hnx.admin.system.service.MenuService;
import com.hnx.admin.system.service.UserService;
import com.hnx.admin.web.json.ResultJson;
import jakarta.validation.Valid;
import lombok.RequiredArgsConstructor;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RestController;

/*
项目名称： core
创 建 人: 倔强的头发
创建日期： 2025/5/26   19:32:25 
描   述：
*/
@RestController
@RequiredArgsConstructor
public class SysLoginController {
    private final UserService userService;
    private final MenuService menuService;
    @LoginLog
    @PostMapping("/login")
    public ResultJson login(@RequestBody @Valid LoginBody loginBody)
    {
      return userService.login(loginBody);
    }
    /**
     * 获取用户信息
     *
     * @return 用户信息
     */
    @GetMapping("getInfo")
    public ResultJson getInfo()
    {
        return userService.getInfo();
    }
    /**
     * 获取路由信息
     *
     * @return 路由信息
     */
    @GetMapping("getRouters")
    public ResultJson getRouters()
    {
        return menuService.selectMenu();
    }
}
